home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Unix / cvs-960311 / bin / cvsinit < prev    next >
Text File  |  1996-03-10  |  5KB  |  162 lines

  1. #! /bin/sh
  2. :
  3. #
  4. #ident    "@(#)cvs:$Name:  $:$Id: cvsinit.sh,v 1.1.1.1 1996/01/20 15:40:25 bbum Exp $"
  5. # Copyright (c) 1992, Brian Berliner
  6. #
  7. # You may distribute under the terms of the GNU General Public License as
  8. # specified in the README file that comes with the CVS 1.4 kit.
  9.  
  10. # This script should be run for each repository you create to help you
  11. # setup your site for CVS.  You may also run it to update existing
  12. # repositories if you install a new version of CVS.
  13.  
  14. # this line is edited by Makefile when creating cvsinit.inst
  15. CVSLIB="/usr/local/cvs/lib/cvs"
  16.  
  17. CVS_VERSION="cvs-1.7"
  18.  
  19. # All purpose usage message, also suffices for --help and --version.
  20. if test $# -gt 0; then
  21.   echo "cvsinit version $CVS_VERSION"
  22.   echo "usage: $0"
  23.   echo "(set CVSROOT to the repository that you want to initialize)"
  24.   exit 0
  25. fi
  26.  
  27. # Make sure that the CVSROOT variable is set
  28. if [ "x$CVSROOT" = x ]; then
  29.     echo "The CVSROOT environment variable is not set."
  30.     echo ""
  31.     echo "You should choose a location for your source repository"
  32.     echo "that can be shared by many developers.  It also helps to"
  33.     echo "place the source repository on a file system that has"
  34.     echo "plenty of free space."
  35.     echo ""
  36.     echo "Please enter the full path for your CVSROOT source repository:"
  37.     read CVSROOT junk
  38.     unset junk
  39.     remind_cvsroot=yes
  40. else
  41.     remind_cvsroot=no
  42. fi
  43.  
  44. # Now, create the $CVSROOT if it is not already there
  45. if [ ! -d $CVSROOT ]; then
  46.     echo "Creating $CVSROOT..."
  47.     path=
  48.     for comp in `echo $CVSROOT | sed -e 's,/, ,g'`; do
  49.     path=$path/$comp
  50.     if [ ! -d $path ]; then
  51.         mkdir $path
  52.     fi
  53.     done
  54. else
  55.     true
  56. fi
  57.  
  58. # Next, check for $CVSROOT/CVSROOT
  59. if [ ! -d $CVSROOT/CVSROOT ]; then
  60.     if [ -d $CVSROOT/CVSROOT.adm ]; then
  61.     echo "You have the old $CVSROOT/CVSROOT.adm directory."
  62.     echo "I will rename it to $CVSROOT/CVSROOT for you..."
  63.     mv $CVSROOT/CVSROOT.adm $CVSROOT/CVSROOT
  64.     else
  65.     echo "Creating the $CVSROOT/CVSROOT directory..."
  66.     mkdir $CVSROOT/CVSROOT
  67.     fi
  68. else
  69.     true
  70. fi
  71. if [ ! -d $CVSROOT/CVSROOT ]; then
  72.     echo "Unable to create $CVSROOT/CVSROOT."
  73.     echo "I give up."
  74.     exit 1
  75. fi
  76.  
  77. # Create the special control files and templates within $CVSROOT/CVSROOT
  78.  
  79. EXAMPLES="checkoutlist commitinfo cvswrappers editinfo loginfo modules 
  80. rcsinfo rcstemplate taginfo wrap unwrap notify"
  81.  
  82. NEWSAMPLE=false
  83. for info in $EXAMPLES; do
  84.     if [ -f $CVSROOT/CVSROOT/${info},v ]; then
  85.     if [ ! -f $CVSROOT/CVSROOT/$info ]; then
  86.         echo "Checking out $CVSROOT/CVSROOT/$info"
  87.         echo "  from $CVSROOT/CVSROOT/${info},v..."
  88.         (cd $CVSROOT/CVSROOT; co -q $info)
  89.     fi
  90.     else
  91.     NEWSAMPLE=true
  92.     if [ -f $CVSROOT/CVSROOT/$info ]; then
  93.         echo "Checking in $CVSROOT/CVSROOT/${info},v"
  94.         echo "  from $CVSROOT/CVSROOT/$info..."
  95.     else
  96.         echo "Creating a sample $CVSROOT/CVSROOT/$info file..."
  97.         case $info in
  98.           modules)
  99.         sed -n -e '/END_REQUIRED_CONTENT/q' \
  100.             -e p $CVSLIB/examples/modules > $CVSROOT/CVSROOT/modules
  101.         ;;
  102.           rcstemplate)
  103.         cp $CVSLIB/examples/$info $CVSROOT/CVSROOT/$info
  104.         ;;
  105.           wrap|unwrap)
  106.         cp $CVSLIB/examples/$info $CVSROOT/CVSROOT/$info
  107.         chmod +x $CVSROOT/CVSROOT/$info
  108.         ;;
  109.           *)
  110.         # comment out everything in all the other examples....
  111.         sed -e 's/^\([^#]\)/#\1/' $CVSLIB/examples/$info > $CVSROOT/CVSROOT/$info
  112.         ;;
  113.         esac
  114.     fi
  115.     (cd $CVSROOT/CVSROOT; ci -q -u -t/dev/null -m"initial checkin of $info" $info)
  116.     fi
  117. done
  118.  
  119. if $NEWSAMPLE ; then
  120.     echo "NOTE:  You may wish to check out the CVSROOT module and edit any new"
  121.     echo "configuration files to match your local requirements."
  122.     echo ""
  123. fi
  124.  
  125. # check to see if there are any references to the old CVSROOT.adm directory
  126. if grep CVSROOT.adm $CVSROOT/CVSROOT/modules >/dev/null 2>&1; then
  127.     echo "Warning: your $CVSROOT/CVSROOT/modules file still"
  128.     echo "    contains references to the old CVSROOT.adm directory"
  129.     echo "    You should really change these to the new CVSROOT directory"
  130.     echo ""
  131. fi
  132.  
  133. # These files are generated from the contrib files.
  134. # FIXME: Is it really wise to overwrite possible local changes like this?
  135. # Normal folks will keep these up to date by modifying the source in
  136. # their CVS module and re-installing CVS, but is everyone OK with that?
  137. #
  138. #
  139. CONTRIBS="log commit_prep log_accum cln_hist"
  140. #
  141. for contrib in $CONTRIBS; do
  142.     echo "Copying the new version of '${contrib}'"
  143.     echo "  to $CVSROOT/CVSROOT for you..."
  144.     cp $CVSLIB/contrib/$contrib $CVSROOT/CVSROOT/$contrib
  145. done
  146.  
  147. # XXX - also add a stub for the cvsignore file
  148.  
  149. # Turn on history logging by default
  150. if [ ! -f $CVSROOT/CVSROOT/history ]; then
  151.     echo "Enabling CVS history logging..."
  152.     touch $CVSROOT/CVSROOT/history
  153.     chmod g+w $CVSROOT/CVSROOT/history
  154.     echo "(Remove $CVSROOT/CVSROOT/history to disable.)"
  155. fi
  156.  
  157. # finish up by running mkmodules
  158. echo "All done!  Running 'mkmodules' as my final step..."
  159. mkmodules $CVSROOT/CVSROOT
  160.  
  161. exit 0
  162.